#ifndef CUSTOMSHORTCUT_H
#define CUSTOMSHORTCUT_H

#include <QObject>
#include <QKeySequence>
#include <QAction>
#include <QShortcut>

class CustomShortcut : public QObject
{
		Q_OBJECT

	public:

		enum ActiveSequence
		{
			DefaultSequence,
			CustomSequence
		};

	public:

		explicit CustomShortcut(const QString& tag, QObject *parent = 0);

		QString tag() const;
		QKeySequence defaultSequence() const;
		QKeySequence customSequence() const;
		ActiveSequence activeSequence() const;

		QKeySequence sequence() const;

		QString text() const;

		void bindTo(QAction* action);
		void bindTo(QShortcut* shortcut);

	signals:

	public slots:

		void setTag(const QString& value);
		void setCustomSequence(const QKeySequence& value);
		void setActiveSequence(ActiveSequence);

		void setSequence(const QKeySequence& value);

	private:

		void applyActiveSequence();

	private:

		QString _tag;
		QKeySequence _defaultSequence;
		QKeySequence _customSequence;
		ActiveSequence _activeSequence;
		QObject* _boundObject; //QAction or QShortcut

};

#endif // CUSTOMSHORTCUT_H
